package cate.game.role.res.farm.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBFarms;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "收获的请求")
@OperationSetter(value = GDOperation.FARM_GAIN_REWARD, sub = "pos")
public class FarmsGainReq implements MsgInput {
    @NoteField("地块的位置, 传0就是一键收获")
    public byte pos;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = cc.getRole().getRes().farm.gain(pos);
        game.notice.message(cc.getRole(), r, true);
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBFarms.GAIN_REQ;
    }
}
